from django.db import models
from utils.models import CoreModel


# Create your models here.

class User(CoreModel):
    username = models.CharField(max_length=40, verbose_name="用户名", help_text="用户名")
    email = models.EmailField(max_length=255, verbose_name="邮箱", help_text="邮箱")
    password = models.CharField(max_length=255, verbose_name="密码", help_text="密码")
    password_decrypt = models.CharField(max_length=255, verbose_name="明文密码", help_text="明文密码")
    avatar = models.TextField(null=True, blank=True, verbose_name="头像", help_text="头像")
    user_type = models.CharField(max_length=20, default="普通用户", null=True, blank=True,
                                 verbose_name="用户类型", help_text="用户类型")
    salt = models.CharField(max_length=255, verbose_name="用户加密盐", help_text="用户加密盐")
    usageNumber = models.IntegerField(default=0, null=True, blank=True, verbose_name="接口调用次数",
                                      help_text="接口调用次数")
    total = models.IntegerField(default=10000, null=True, blank=True, verbose_name="接口总次数",
                                help_text="接口总次数")

    class Meta:
        db_table = "application_user"
        verbose_name = 'APP热更新用户表'
        verbose_name_plural = verbose_name
        ordering = ('-create_time', 'sort',)
